<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$return['pluginset']=$this->setting;
cfc('core')->checklogin();
if($_RQ['op']=='main'){
	$isxuni=intval($_RQ['isxuni']);
	$return['setting']=$this->plugin_setting('page_setting');
	$params=array('mid'=>$_SESSION['uid'],'merchid'=>$_SESSION['onemerchid']);
	if($isxuni){
		$params['level']=18;
	}
	$return['commission_money']=$this->sum('order',$params,'commission_money');
	$return['commission_total']=$this->count('order',$params);
	$levels=array();
	$return['area_types']=$this->area_types;
	$return['levels']=$levels;
	$return['list']=array();
	$return['params']=array(
		'isarea'=>$isarea,
		'isxuni'=>$isxuni,
		'level'=>1,
		'page'=>1,
	);
	$return['psize']=20;
	$return['xuniname']=$this->xuniname;
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('mid'=>$_SESSION['uid'],'merchid'=>$_SESSION['onemerchid']);
	$psize=20;
	$pindex=intval($_RQ['page'])?:1;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		
	);
	$list=$this->get_list('order',$parameter);
	if(!$list){
		exi('none');
	}
	foreach($list as &$item){
		$order=$this->get('order',array('ordersn'=>$item['ordersn']));
		$item['member']=model('core/member')->basic($order['mid']);
		//$item['order']=$order;
	}
	//exi('num'.count($list),'error');
	exi($list);
}
?>